<div id="sub_nav">
      <p>Quick Links:</p>
      <ul>
        <li></li>

      </ul>
    </div>
<div class="breadcrumb">
    <ul id="breadcrumb">
        <li><a href="<?php echo Configure::read('base_url');?>backstage" title="Home">
		<?php echo $this->Html->image("home.png", array("alt" => "Home",'class'=>'home','border'=>'0'));?>
		</a></li>
        <li><a href="<?php echo Configure::read('base_url');?>backstage/returnpolicies/add" title="Return Policy">Return Policy</a></li>

    </ul>
</div>
<?php echo $this->element('admin/admin_leftmenu'); ?>
<div id="left">

    <!-- begin all content here -->

    <br class="clear" />

    <!-- success --><!-- error -->
    <?php
    echo $this->Session->flash();
    if ($this->Session->check('Message.auth'))
        echo $this->Session->flash('auth');
    ?>
    <div class="div_header"><?php __('Return Policy'); ?></div>
    <div class="div_content">
        <div class="returnpolicies form">
 <form method="post" id="suspendfrm" action="<?php echo Configure::read('base_url')."backstage/returnpolicies/add"; ?>" enctype="multipart/form-data">
	
	        <?php echo $form->textarea('Returnpolicy.policy', array('cols' => '85', 'rows' => '15','class'=>'fckrequired','value'=>$returnpolicy['Returnpolicy']['policy']));?>
		<?php echo $fck->load('Returnpolicy.policy', 'Custom');?>
	<?php echo 'Space left: <span id="counter3"></span> of 2000 characters';?>
<input type="submit" style="background:#73AE0B;  margin-left:440px; color:#fff; font-size:14px;" name="button" id="button" value="Submit" />
</form>
            <div id="word_count"></div>

</div>
            </div>
            <div class="div_bottom"></div>
        </div>

        <!-- edit sidebar items here -->

        </div>
<?php
                        echo $this->Html->css('table_css');
?>

<?php echo $html->script(array("jquery.pagination.js", "jquery.tablesorter.min.js", "jquery.tablednd.js","jquery.simplyCountable","jquery.validate.js")); ?>
<script type="text/javascript">

    jQuery(document).ready(function(){
        jQuery("#category_table").tablesorter({headers: {4:{sorter: false}, 5:{sorter: false}}});
        
        jQuery.validator.addMethod("fckrequired", function (value, element) {
        var oEditor = FCKeditorAPI.GetInstance('ReturnpolicyPolicy') ;
        var pageValue = oEditor.GetHTML(true);
        pageValue=jQuery.trim(pageValue);
                
        if ( pageValue == "<br />" || pageValue == "") {
            return false;
        }else{
            return true;
        }
    }, "This field is required.");

        var v = jQuery("#suspendfrm").validate({
            

                       });
        jQuery('#ReturnpolicyPolicy').simplyCountable({
		counter: '#counter3',
        countType: 'characters',
        maxCount: 2000,
        countDirection: 'down'
	});

    });

      function strip_tags(html){

		//PROCESS STRING
		if(arguments.length < 3) {
			html=html.replace(/<\/?(?!\!)[^>]*>/gi, '');
		} else {
			var allowed = arguments[1];
			var specified = eval("["+arguments[2]+"]");
			if(allowed){
				var regex='</?(?!(' + specified.join('|') + '))\b[^>]*>';
				html=html.replace(new RegExp(regex, 'gi'), '');
			} else{
				var regex='</?(' + specified.join('|') + ')\b[^>]*>';
				html=html.replace(new RegExp(regex, 'gi'), '');
			}
		}

		//CHANGE NAME TO CLEAN JUST BECAUSE
		var clean_string = html;

		//RETURN THE CLEAN STRING
		return clean_string;
	}

        function FCKeditor_OnComplete(editorInstance) {
     counterword(editorInstance);
   editorInstance.Events.AttachEvent('OnSelectionChange', counterword);
   }

   function counterword(){
       var oEditor = FCKeditorAPI.GetInstance('ReturnpolicyPolicy') ;
       var pageValue = oEditor.GetHTML(true);
       var hh=strip_tags(pageValue);
       var leth=hh.length;
       var remain=(2000-leth);
       if(remain<0){
           remain=0;
           
       }
    
       document.getElementById('counter3').innerHTML = remain;

    }
</script>